<?php 
//File ini untuk mengedit record
require_once('lib/dbclass.php');
$db = new MySQL();

// ubah data tabel profile
$x = $_GET['id'];
if(isset($_POST['ubah'])){	
	
	$profil = $_POST['profil'];

	if (! $db->Query("UPDATE profil set profil='$profil' WHERE id_profil='$x'")) $db->Kill(); 

	echo '<script>';
	echo "alert('Success: Anda berhasil merubah Profil');";
	echo "window.location='index.php?q=7'";
	echo '</script>';
}

?>

<?php 
	//Select Data Berita 
	if(isset($_GET['id'])){		
		if (! $db->Query("SELECT * FROM profil WHERE id_profil=$x")) $db->Kill(); 
		if($db->RowCount()>0){
			$rs = $db->RowArray();
		}
	}
?>	

<h2>Edit Profil</h2>

		<form class="form-horizontal" role="form" action="" method="post">
			
			<div class="form-group">
						
				<label for="body" class="col-sm-2 control-label">Profil :</label>
				<div class="col-sm-10">
				<textarea class="form-control editor" name="profil" id="profil" rows="12" placeholder="Page Body"><?php echo $rs[1];?></textarea>
				</div>
			</div>
				
			<div class="form-group">
					
				<label for="body" class="col-sm-2 control-label"></label>
				<div class="col-sm-10">
					&nbsp;
				</div>
			</div>
			
			<div class="form-group">
   			<div class="col-sm-offset-2 col-sm-10">
			<button type="submit" class="btn btn-success">Save</button>
			<input type="hidden" name="ubah" value="Ubah">
			</div>
			</div>
			
</form>